/*!
\file
\brief
	Declaration of AttributeInfo.
\details
\bug
	none
\todo
	none
\date
	January 20, 2008 - first version of the file.
\author
	Copyright (C) 2008 Vadym Hulakov, mailto:hulakov@gmail.com. All rights reserved.
*/

#ifndef ATTRIBUTEINFO_H
#define ATTRIBUTEINFO_H

#include "ItemBase.h"
#include "ClassMemberAccess.h"
#include "Type.h"

namespace ObjectModel
{
	class Type;
	class ClassType;

	class Variable : public ItemBase
	{
	protected:
		//! @name Construction and destruction
		//@{
		Variable(const wchar_t* name, const Type& type,
			ClassMemberAccess access, const wchar_t* description)
			: ItemBase(name, description), _access(access), _type(&type)
		{
		}

		Variable(const Variable& v)
			: ItemBase(v.getName().c_str(), v.getDescription().c_str())
			, _access(v._access)
			, _type(v._type)
		{
		}

		//@}

	public:
		//! @name Properties
		//@{
		//! Get type of the attribute.
		//! @return
		//!		Type of attribute.
		const Type& getType() const { return *_type; }

		//! Get access rights to attribute.
		//! @return
		//!		Access rights to attribute.
		ClassMemberAccess getAccess() const { return _access; }

		//@}

	private:
		ClassMemberAccess _access;
		const Type* _type;
	};

	//! Description of attribute of a class.
	class Attribute : public Variable
	{
		friend class ClassType;
	private:
		Attribute(const wchar_t* name, const Type& type,
			ClassMemberAccess access, const wchar_t* description)
			: Variable(name, type, access, description)
		{
		}
	};

	//! Description of parameter of a method.
	class Parameter : public Variable
	{
		friend class Method;
	private:
		Parameter(const wchar_t* name, const Type& type,
			ClassMemberAccess access, const wchar_t* description)
			: Variable(name, type, access, description)
		{
		}

	};
}

#endif // ATTRIBUTEINFO_H
